<?php
/**
 * 退出
 * Created by PhpStorm.
 * User: zhang-hong
 * Date: 2017/3/6
 * Time: 17:46
 */
class SettixingyizhuController extends Yaf_Controller_Abstract
{
    function IndexAction()
    {
        //初始化
        //G('begin');
        $request = $this->getRequest();
        $user_number = $request->getPost("user_number","");
        $user_name = $request->getPost("user_name","");
        $yiyuan_id = $request->getPost("yiyuan_id","");
        $zuhao = $request->getPost("zuhao","");
        $upload_time = $request->getPost("upload_time","");
        if($user_number == "")
        {
            Utility::apiJsonError(20030, '用户不能为空');
        }
        if($zuhao == "")
        {
            Utility::apiJsonError(20031, '组号不能为空');
        }
        if($user_name == "")
        {
            Utility::apiJsonError(20032, '用户名不能为空');
        }

        if($upload_time == "")
        {
            Utility::apiJsonError(20038, '上传时间不能为空');
        }

        if(!ctype_digit("$yiyuan_id"))
        {
            Utility::apiJsonError(20027, '医院ID必须是整型');
        }

        $insert_arr = array(
            "zuhao"=>$zuhao,
            "user_number"=>$user_number,
            "user_name"=>$user_name,
            "addtime"=>time(),
            "yiyuan_id"=>$yiyuan_id,
            "upload_time"=>$upload_time,
        );
        $insert = DB::insert("zhuyuan_yizhu_tixing_info_yidu")
            ->columns(array_keys($insert_arr))
            ->values(array_values($insert_arr));
        list($insert_id, $affected_rows) = $insert->execute();
        $result['msg'] = "";
        $result['error'] = 200;
        Utility::apiJsonResultExtends($result);
    }
}